<!DOCTYPE html>





<html class="theme-next gemini use-motion" lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="generator" content="Hexo 3.9.0">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=7.3.0">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=7.3.0">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=7.3.0">
  <link rel="mask-icon" href="/images/logo.svg?v=7.3.0" color="#222">
  <meta name="google-site-verification" content="uSLhm-2JUAoM7eOTok7L19IyTJqp7dgwYpDu8dthN5Y" />

<link rel="stylesheet" href="/css/main.css?v=7.3.0">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.7.0">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/theme-next/theme-next-needmoreshare2@1/needsharebutton.min.css">
  <link rel="stylesheet" href="/lib/pace/pace-theme-center-atom.min.css?v=1.0.2">
  <script src="/lib/pace/pace.min.js?v=1.0.2"></script>


<script id="hexo-configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '7.3.0',
    exturl: false,
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":true},
    back2top: {"enable":true,"sidebar":true,"scrollpercent":true},
    save_scroll: false,
    copycode: {"enable":true,"show_result":true,"style":"mac"},
    fancybox: false,
    mediumzoom: false,
    lazyload: false,
    pangu: false,
    algolia: {
      appID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    },
    localsearch: {"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},
    path: '',
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    translation: {
      copy_button: '复制',
      copy_success: '复制成功',
      copy_failure: '复制失败'
    }
  };
</script>

  <meta name="description" content="前言博客刚开,转载几篇文章充实一下~ 转自知乎: DJ Hitori 的回答">
<meta name="keywords" content="编程,生活,算法">
<meta property="og:type" content="article">
<meta property="og:title" content="买苹果流程--程序运行思路">
<meta property="og:url" content="https://www.wootec.top/2019/08/18/买苹果流程-程序运行思路/index.html">
<meta property="og:site_name" content="Reverier 个人博客">
<meta property="og:description" content="前言博客刚开,转载几篇文章充实一下~ 转自知乎: DJ Hitori 的回答">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2019-08-19T04:33:29.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="买苹果流程--程序运行思路">
<meta name="twitter:description" content="前言博客刚开,转载几篇文章充实一下~ 转自知乎: DJ Hitori 的回答">
  <link rel="alternate" href="/atom.xml" title="Reverier 个人博客" type="application/atom+xml">
  <link rel="canonical" href="https://www.wootec.top/2019/08/18/买苹果流程-程序运行思路/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome: false,
    isPost: true,
    isPage: false,
    isArchive: false
  };
</script>

  <title>买苹果流程--程序运行思路 | Reverier 个人博客</title>
  








  <noscript>
  <style>
  .use-motion .motion-element,
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-title { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  <div class="container sidebar-position-left">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta">

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Reverier 个人博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
        <p class="site-subtitle">Hope, Marvel, Youth.</p>
      
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
      
      
      
        
        <li class="menu-item menu-item-home">
      
    
      
    

    <a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-about">
      
    
      
    

    <a href="/about/" rel="section"><i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-tags">
      
    
      
    

    <a href="/tags/" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签<span class="badge">15</span></a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-categories">
      
    
      
    

    <a href="/categories/" rel="section"><i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类<span class="badge">11</span></a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-archives">
      
    
      
    

    <a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档<span class="badge">16</span></a>

  </li>
  </ul>

</nav>
</div>
    </header>

    

  <a href="https://github.com/Reverier-Xu" class="github-corner" title="My tour on GitHub" aria-label="My tour on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
            

          <div id="content" class="content page-post-detail">
            

  <div id="posts" class="posts-expand">
    

  <article class="post" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://www.wootec.top/2019/08/18/买苹果流程-程序运行思路/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Reverier Xu">
      <meta itemprop="description" content="Hope, Marvel, Youth.">
      <meta itemprop="image" content="/images/Reverier.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Reverier 个人博客">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">买苹果流程--程序运行思路

          
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              
                
              

              <time title="创建时间：2019-08-18 16:40:30" itemprop="dateCreated datePublished" datetime="2019-08-18T16:40:30+08:00">2019-08-18</time>
            </span>
          
            

            
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2019-08-19 12:33:29" itemprop="dateModified" datetime="2019-08-19T12:33:29+08:00">2019-08-19</time>
              </span>
            
          
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/编程思想/" itemprop="url" rel="index"><span itemprop="name">编程思想</span></a></span>

                
                
              
            </span>
          

          
            <span class="post-meta-item" title="阅读次数">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span class="busuanzi-value" id="busuanzi_value_page_pv"></span>
            </span>
          

                    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h1><p>博客刚开,转载几篇文章充实一下~</p>
<p>转自知乎: <a href="https://www.zhihu.com/question/22508677/answer/141334678" target="_blank" rel="noopener">DJ Hitori 的回答</a></p>
<a id="more"></a>
<h1 id="第一代版本"><a href="#第一代版本" class="headerlink" title="第一代版本"></a>第一代版本</h1><p>普通人：</p>
<p>我今天要买一斤苹果。</p>
<p>程序员：</p>
<p>我今天要买一斤苹果。</p>
<p>因为我只喜欢红富士苹果，所以我只买红富士苹果。</p>
<p>我能接受的最高价格是10元/斤。</p>
<p>正常情况下一斤苹果用一个袋子能装下，但是为防万一，我会带两个袋子。</p>
<p>我知道附近的3家水果店，所以我会依次访问这3家水果店。</p>
<p>根据上述条件，我设计出以下的买苹果的流程：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br></pre></td><td class="code"><pre><span class="line">买苹果流程开始</span><br><span class="line">    对水果店0、水果店1、水果店2依次执行：</span><br><span class="line">    拜访一家水果店流程开始</span><br><span class="line">        走到此水果店</span><br><span class="line">        如果此水果店没有开门，则结束当前的“拜访一家水果店流程”</span><br><span class="line">        如果此水果店没有苹果，则结束当前的“拜访一家水果店流程”</span><br><span class="line">        如果此水果店的苹果当中没有红富士苹果，则结束当前的“拜访一家水果店流程”</span><br><span class="line">        如果此水果店的红富士苹果剩余不到一斤，则结束当前的“拜访一家水果店流程”</span><br><span class="line">        如果此水果店的红富士苹果的价格高于10元/斤，则执行3次：</span><br><span class="line">        讲价流程开始</span><br><span class="line">            询问店主是否愿意将价格降到10元/斤或更低</span><br><span class="line">            如果店主愿意，则跳过剩余的“讲价流程”</span><br><span class="line">        讲价流程结束</span><br><span class="line">        如果此水果店的红富士苹果的价格仍然高于10元/斤，则结束当前的“拜访一家水果店流程”</span><br><span class="line">        打开一个袋子，将其作为当前的袋子</span><br><span class="line">        重复执行以下流程，直到总重量大于一斤：</span><br><span class="line">        装袋一个苹果流程开始</span><br><span class="line">            从所有的不在袋子中的红富士苹果中选出最好的一个</span><br><span class="line">            如果此苹果能装入当前的袋子，则将此苹果装入当前的袋子，否则执行：</span><br><span class="line">            换袋子流程开始</span><br><span class="line">                如果我有剩余的袋子，则从中任意选出一个并作为当前的袋子，否则执行：</span><br><span class="line">                向店主要袋子流程开始</span><br><span class="line">                    向店主索要一个袋子</span><br><span class="line">                    如果店主拒绝给我袋子，则将我的所有袋子里的所有苹果取出，然后结束当前的“拜访一家水果店流程”</span><br><span class="line">                    将店主给我的袋子作为当前的袋子</span><br><span class="line">                向店主要袋子流程结束</span><br><span class="line">            换袋子流程结束</span><br><span class="line">            测量我的所有袋子里的所有苹果的总重量</span><br><span class="line">        装袋一个苹果流程结束</span><br><span class="line">        根据我的所有袋子里的所有苹果的总重量和店主给出的价格，计算我应付的价格</span><br><span class="line">        向店主询问我应付的价格</span><br><span class="line">        如果我不接受店主索要的价格，则执行3次：</span><br><span class="line">        校对流程开始</span><br><span class="line">            向店主解释我计算出的价格，并询问其是否同意</span><br><span class="line">            如果店主同意，则跳过剩余的“校对流程”</span><br><span class="line">        校对流程结束</span><br><span class="line">        如果我仍然不接受店主索要的价格，则将我的所有袋子里的所有苹果取出，然后结束当前的“拜访一家水果店流程”</span><br><span class="line">        如果我没带钱，则将我的所有袋子里的所有苹果取出，然后结束当前的“拜访一家水果店流程”</span><br><span class="line">        付钱拿走苹果</span><br><span class="line">        跳过剩余的“拜访一家水果店流程”</span><br><span class="line">    拜访一家水果店流程结束</span><br><span class="line">买苹果流程结束</span><br></pre></td></tr></table></figure>

<h1 id="小测试"><a href="#小测试" class="headerlink" title="小测试"></a>小测试</h1><p>这个流程怎么样？我来设计一些测试样例，测试一下这个流程。</p>
<p>测试发现一个问题：如果水果店0和水果店1都有红富士苹果并且价格都低于10元/斤，而且水果店1的价格比水果店0更低，那么我希望买水果店1的苹果，但我设计的流程会让我买水果店0的苹果。</p>
<p>为了解决这个问题，我应该先询问所有水果店的价格，然后去价格最低的那一家买苹果。</p>
<p>经过修改，我重新设计出以下的买苹果的流程：</p>
<h1 id="第二代版本"><a href="#第二代版本" class="headerlink" title="第二代版本"></a>第二代版本</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line">买苹果流程开始</span><br><span class="line">    对水果店0、水果店1、水果店2依次执行：</span><br><span class="line">    询问一家水果店的红富士价格流程开始</span><br><span class="line">        走到此水果店</span><br><span class="line">        如果此水果店没有开门，则视此水果店的红富士价格为无穷大元/斤，并结束当前的“询问一家水果店的红富士价格流程”</span><br><span class="line">        如果此水果店没有苹果，则视此水果店的红富士价格为无穷大元/斤，并结束当前的“询问一家水果店的红富士价格流程”</span><br><span class="line">        如果此水果店的苹果当中没有红富士苹果，则视此水果店的红富士价格为无穷大元/斤，并结束当前的“询问一家水果店的红富士价格流程”</span><br><span class="line">        如果此水果店的红富士苹果剩余不到一斤，则视此水果店的红富士价格为无穷大元/斤，并结束当前的“询问一家水果店的红富士价格流程”</span><br><span class="line">        向店主询问此水果店的红富士苹果价格并记录</span><br><span class="line">    询问一家水果店的红富士价格流程结束</span><br><span class="line">    从3家水果店中选出红富士价格最低的一家（如果有并列则随机选择），将其作为目标水果店</span><br><span class="line">    如果目标水果店的红富士苹果价格为无穷大元/斤，则结束当前的“买苹果流程”</span><br><span class="line">    走到目标水果店</span><br><span class="line">    如果此水果店的红富士苹果的价格高于10元/斤，则执行3次：</span><br><span class="line">    讲价流程开始</span><br><span class="line">        询问店主是否愿意将价格降到10元/斤或更低</span><br><span class="line">        如果店主愿意，则跳过剩余的“讲价流程”</span><br><span class="line">    讲价流程结束</span><br><span class="line">    如果此水果店的红富士苹果的价格仍然高于10元/斤，则结束当前的“买苹果流程”</span><br><span class="line">    打开一个袋子，将其作为当前的袋子</span><br><span class="line">    重复执行以下流程，直到总重量大于一斤：</span><br><span class="line">    装袋一个苹果流程开始</span><br><span class="line">        从所有的不在袋子中的红富士苹果中选出最好的一个</span><br><span class="line">        如果此苹果能装入当前的袋子，则将此苹果装入当前的袋子，否则执行：</span><br><span class="line">        换袋子流程开始</span><br><span class="line">            如果我有剩余的袋子，则从中任意选出一个并作为当前的袋子，否则执行：</span><br><span class="line">            向店主要袋子流程开始</span><br><span class="line">                向店主索要一个袋子</span><br><span class="line">                如果店主拒绝给我袋子，则将我的所有袋子里的所有苹果取出，然后结束当前的“买苹果流程”</span><br><span class="line">                将店主给我的袋子作为当前的袋子</span><br><span class="line">            向店主要袋子流程结束</span><br><span class="line">        换袋子流程结束</span><br><span class="line">        测量我的所有袋子里的所有苹果的总重量</span><br><span class="line">    装袋一个苹果流程结束</span><br><span class="line">    根据我的所有袋子里的所有苹果的总重量和店主给出的价格，计算我应付的价格</span><br><span class="line">    向店主询问我应付的价格</span><br><span class="line">    如果我不接受店主索要的价格，则执行3次：</span><br><span class="line">    校对流程开始</span><br><span class="line">        向店主解释我计算出的价格，并询问其是否同意</span><br><span class="line">        如果店主同意，则跳过剩余的“校对流程”</span><br><span class="line">    校对流程结束</span><br><span class="line">    如果我仍然不接受店主索要的价格，则将我的所有袋子里的所有苹果取出，然后结束当前的“买苹果流程”</span><br><span class="line">    如果我没带钱，则将我的所有袋子里的所有苹果取出，然后结束当前的“买苹果流程”</span><br><span class="line">    付钱拿走苹果</span><br><span class="line">买苹果流程结束</span><br></pre></td></tr></table></figure>

<h1 id="再次运行"><a href="#再次运行" class="headerlink" title="再次运行"></a>再次运行</h1><p>现在这个流程是不是完美了呢？不是，我还能发现很多问题。<br>如果3家水果店都有红富士苹果但都不到一斤，但是三家店加起来能达到一斤，那么我不应该结束流程回家，而是应该把三家店的红富士苹果都买下来。<br>如果我向水果店询问价格的时候这家店还有红富士苹果，但我询问完所有水果店的价格后这家店的红富士苹果卖完了，那么我的流程会让我试图处理不存在的红富士苹果。<br>我走路的过程中可能会遇到突发事件，比如发现了新的水果店，比如袋子破掉了苹果掉一地，对于这些情况我的流程都无法进行处理。</p>
<p>啊问题太多了我懒得再改流程了。我还是去X宝买吧。<br>那么接下来我要设计一个在X宝买红富士苹果的流程……</p>
<h1 id="后话"><a href="#后话" class="headerlink" title="后话"></a>后话</h1><p>这个答案我很久之前就收藏了哈哈哈~</p>
<p>很好的阐述了编程的魅力,早就想放在博客里了,但是想了一下自己写一套出来无非就是这样的,索性就直接转载了~</p>

      
    </div>

    
    
    
<div>
  
    <div>
    
        <div style="text-align:center;color: #ccc;font-size:14px;">--本文结束-😁-感谢您的阅读!--</div>
    
</div>

  
</div>
      

      

      
        
      
      

      

      <footer class="post-footer">
        
          
            
          
          <div class="post-tags">
            
              <a href="/tags/编程/" rel="tag"><i class="fa fa-tag"></i> 编程</a>
            
              <a href="/tags/生活/" rel="tag"><i class="fa fa-tag"></i> 生活</a>
            
              <a href="/tags/算法/" rel="tag"><i class="fa fa-tag"></i> 算法</a>
            
          </div>
        

        
  <div class="post-widgets">
    <div class="social-share">
      
      
        <div id="needsharebutton-postbottom">
          <span class="btn">
            <i class="fa fa-share-alt" aria-hidden="true"></i>
          </span>
        </div>
      
    </div>
  
  </div>


        
          <div class="post-nav">
            <div class="post-nav-next post-nav-item">
              
                <a href="/2019/08/16/hello-world/" rel="next" title="Hello World">
                  <i class="fa fa-chevron-left"></i> Hello World
                </a>
              
            </div>

            <span class="post-nav-divider"></span>

            <div class="post-nav-prev post-nav-item">
              
                <a href="/2019/08/18/The-Elementary-Of-Programming-Style/" rel="prev" title="The Elementary Of Programming Style">
                  The Elementary Of Programming Style <i class="fa fa-chevron-right"></i>
                </a>
              
            </div>
          </div>
        
      </footer>
    
  </div>
  
  
  
  </article>
  </div>


          </div>
          
    
    
  <div class="comments" id="comments">
    <div id="lv-container" data-id="city" data-uid="MTAyMC80NjE1MC8yMjY2MQ=="></div>
  </div>
  
  

        </div>
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-overview">

          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image"
      src="/images/Reverier.png"
      alt="Reverier Xu">
  <p class="site-author-name" itemprop="name">Reverier Xu</p>
  <div class="site-description motion-element" itemprop="description">Hope, Marvel, Youth.</div>
</div>
  <nav class="site-state motion-element">
      <div class="site-state-item site-state-posts">
        
          <a href="/archives/">
        
          <span class="site-state-item-count">16</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
    
      
      
      <div class="site-state-item site-state-categories">
        
          
            <a href="/categories/">
          
        
        
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
        <span class="site-state-item-count">11</span>
        <span class="site-state-item-name">分类</span>
        </a>
      </div>
    
      
      
      <div class="site-state-item site-state-tags">
        
          
            <a href="/tags/">
          
        
        
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
        <span class="site-state-item-count">15</span>
        <span class="site-state-item-name">标签</span>
        </a>
      </div>
    
  </nav>
  <div class="feed-link motion-element">
    <a href="/atom.xml" rel="alternate">
      <i class="fa fa-rss"></i>RSS
    </a>
  </div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
      
      
        
      
      
        <a href="https://github.com/Reverier-Xu" title="GitHub &rarr; https://github.com/Reverier-Xu" rel="noopener" target="_blank">GitHub</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        <a href="https://stackoverflow.com/users/12383772/reverier" title="StackOverflow &rarr; https://stackoverflow.com/users/12383772/reverier" rel="noopener" target="_blank">StackOverflow</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        <a href="mailto:reverier.xu@gmail.com" title="E-Mail &rarr; mailto:reverier.xu@gmail.com" rel="noopener" target="_blank">E-Mail</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        <a href="https://weibo.com/dreamskytech" title="微博 &rarr; https://weibo.com/dreamskytech" rel="noopener" target="_blank">微博</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        <a href="https://www.zhihu.com/people/reverier-78/activities" title="知乎 &rarr; https://www.zhihu.com/people/reverier-78/activities" rel="noopener" target="_blank">知乎</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        <a href="https://user.qzone.qq.com/773389969" title="Qzone &rarr; https://user.qzone.qq.com/773389969" rel="noopener" target="_blank">Qzone</a>
      </span>
    
  </div>
  <div class="cc-license motion-element" itemprop="license">
    
  
    <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" class="cc-opacity" rel="noopener" target="_blank"><img src="/images/cc-by-nc-sa.svg" alt="Creative Commons"></a>
  </div>


  <div class="links-of-blogroll motion-element links-of-blogroll-block">
    <div class="links-of-blogroll-title">
      <i class="fa  fa-fw fa-link"></i>
      友情链接~
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="https://www.std-frank.club/" title="https://www.std-frank.club/" rel="noopener" target="_blank">Frank</a>
        </li>
      
        <li class="links-of-blogroll-item">
          <a href="https://eqqie.cn/" title="https://eqqie.cn/" rel="noopener" target="_blank">赤道企鹅</a>
        </li>
      
        <li class="links-of-blogroll-item">
          <a href="https://cor1e.cn/" title="https://cor1e.cn/" rel="noopener" target="_blank">Cor1e</a>
        </li>
      
        <li class="links-of-blogroll-item">
          <a href="https://yunq1ao.com/" title="https://yunq1ao.com/" rel="noopener" target="_blank">yunq1ao</a>
        </li>
      
        <li class="links-of-blogroll-item">
          <a href="https://shal10w.github.io/" title="https://shal10w.github.io/" rel="noopener" target="_blank">shal10w</a>
        </li>
      
        <li class="links-of-blogroll-item">
          <a href="https://blog.csdn.net/arttnba3/" title="https://blog.csdn.net/arttnba3/" rel="noopener" target="_blank">arttnba3</a>
        </li>
      
    </ul>
  </div>


        </div>
      </div>
      <!--noindex-->
        <div class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
            
            
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#前言"><span class="nav-number">1.</span> <span class="nav-text">前言</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#第一代版本"><span class="nav-number">2.</span> <span class="nav-text">第一代版本</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#小测试"><span class="nav-number">3.</span> <span class="nav-text">小测试</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#第二代版本"><span class="nav-number">4.</span> <span class="nav-text">第二代版本</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#再次运行"><span class="nav-number">5.</span> <span class="nav-text">再次运行</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#后话"><span class="nav-number">6.</span> <span class="nav-text">后话</span></a></li></ol></div>
            

          </div>
        </div>
      <!--/noindex-->
      
        <div class="back-to-top motion-element">
          <i class="fa fa-arrow-up"></i>
          
            <span id="scrollpercent"><span>0</span>%</span>
          
        </div>
      

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2019 – <span itemprop="copyrightYear">2020</span>
  <span class="with-love" id="animate">
    <i class="fa fa-free-code-camp"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Reverier Xu</span>
</div>
<script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
  

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item-icon">
      <i class="fa fa-user"></i>
    </span>
    <span class="site-uv" title="总访客量">
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
    </span>
  
    <span class="post-meta-divider">|</span>
  
    <span class="post-meta-item-icon">
      <i class="fa fa-eye"></i>
    </span>
    <span class="site-pv" title="总访问量">
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
    </span>
  
</div>








        
      </div>
    </footer>
      <div class="reading-progress-bar"></div>

    
  
  <div id="needsharebutton-float">
    <span class="btn">
      <i class="fa fa-share-alt" aria-hidden="true"></i>
    </span>
  </div>
<script src="//cdn.jsdelivr.net/gh/theme-next/theme-next-needmoreshare2@1/needsharebutton.min.js"></script>
<script>
    pbOptions = {};
      pbOptions.iconStyle = "default";
    
      pbOptions.boxForm = "horizontal";
    
      pbOptions.position = "bottomCenter";
    
      pbOptions.networks = "Weibo,Wechat,Douban,QQZone,Twitter,Facebook";
    
    new needShareButton('#needsharebutton-postbottom', pbOptions);
    flOptions = {};
      flOptions.iconStyle = "default";
    
      flOptions.boxForm = "horizontal";
    
      flOptions.position = "middleRight";
    
      flOptions.networks = "Weibo,Wechat,Douban,QQZone,Twitter,Facebook";
    
    new needShareButton('#needsharebutton-float', flOptions);
</script>


  </div>

  
    
  
  <script color='0,0,255' opacity='0.5' zIndex='-1' count='99' src="/lib/canvas-nest/canvas-nest.min.js"></script>
  <script src="/lib/jquery/index.js?v=3.4.1"></script>
  <script src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  <script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

<script src="/js/utils.js?v=7.3.0"></script><script src="/js/motion.js?v=7.3.0"></script>

<script src="/js/schemes/pisces.js?v=7.3.0"></script>



<script src="/js/next-boot.js?v=7.3.0"></script>




  
  <script>
    (function(){
      var bp = document.createElement('script');
      var curProtocol = window.location.protocol.split(':')[0];
      bp.src = (curProtocol === 'https') ? 'https://zz.bdstatic.com/linksubmit/push.js' : 'http://push.zhanzhang.baidu.com/push.js';
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(bp, s);
    })();
  </script>




























  

  

  


  
  <script src="/js/scrollspy.js?v=7.3.0"></script><script src="/js/post-details.js?v=7.3.0"></script>


<script>
  window.livereOptions = {
    refer: location.pathname.replace(CONFIG.root, '').replace('index.html', '')
  };
  (function(d, s) {
    var j, e = d.getElementsByTagName(s)[0];
    if (typeof LivereTower === 'function') { return; }
    j = d.createElement(s);
    j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
    j.async = true;
    e.parentNode.insertBefore(j, e);
  })(document, 'script');
</script>

  <link rel="stylesheet" href="/dist/APlayer.min.css">
  <div id="aplayer"></div>
  <script type="text/javascript" src="/dist/APlayer.min.js"></script>
  <script type="text/javascript" src="/dist/music.js"></script>
</body>
</html>
<!-- 页面点击小红心 -->
<script type="text/javascript" src="/js/src/clicklove.js"></script>
